home *** CD-ROM | disk | FTP | other *** search
- Path: andrew.cmu.edu!postman+
- From: Jim_Mann@transarc.com
- Newsgroups: comp.lang.c
- Subject: Re: why arrays may seem like pointers (was: What is &Variable ... )
- Date: Wed, 28 Feb 1996 14:38:49 -0500
- Organization: Carnegie Mellon, Pittsburgh, PA
- Message-ID: <MlB_x9_SMUE45Cwf9Q@transarc.com>
- References: <4gsdno$1bg@umbc9.umbc.edu> <4gtab6$acb@ceylon.gte.com> <313318b8.53776146@nntp.ix.netcom.com>
- <DnHyrp.CF8@eskimo.com>
- NNTP-Posting-Host: po6.andrew.cmu.edu
- In-Reply-To: <DnHyrp.CF8@eskimo.com>
-
- scs@eskimo.com (Steve Summit) writes:
- > I know of at least two reasons why confusion here persists.
-
- I think there are serveral others, mostly dealing with common methods
- of using arrays and pointers.
-
- First of all, if I declare
-
- char foo[20];
-
- I can access elements using *foo.
-
- Similarly, if I declare (and later allocate)
-
- char *foo;
-
- I can acess elements as foo[3];
-
- Also, if I declare fooA as an array and fooP as a pointer, I can
- make assigments like fooP = fooA.
-
- For reasons like this, many newer C programmers get to thinking that
- arrays and pointers are pretty much the same thing.
-
- ******************************************************************
- Jim Mann jmann@transarc.com
- Transarc Corporation
- The Gulf Tower, 707 Grant Street, Pittsburgh, PA 15219 (412) 338-4442
- WWW Homepage: http://www.transarc.com/~jmann/Home.html
-